<template>
  <div class="app">
    <div class="container-fluid container-application">
      <div class="main-content position-relative">
        <!-- Page content -->
        <div class="page-content">
          <div class="min-vh-100 py-5 d-flex align-items-center">
            <div class="w-100">
              <div class="row justify-content-center">
                <div class="col-sm-8 col-lg-4">
                  <div class="card shadow zindex-100 mb-0">
                    <div class="card-body px-md-5 py-5">
                      <div class="mb-5">
                        <h6 class="h3">传智教育-登录</h6>
                      </div>
                      <span class="clearfix"></span>
                      <el-form
                        label-position="right"
                        label-width="80px"
                        :model="form"
                      >
                        <el-form-item label="账号：">
                          <el-input
                            v-model="form.username"
                            placeholder="请输入账号"
                          ></el-input>
                        </el-form-item>
                        <el-form-item label="密码：">
                          <el-input
                            v-model="form.password"
                            placeholder="请输入密码"
                            type="password"
                          ></el-input>
                        </el-form-item>
                        <el-button @click="onSubmit" type="primary"
                          >登录</el-button
                        >
                      </el-form>
                    </div>
                    <div class="card-footer px-md-5">
                      <small>没有注册？</small>
                      <router-link
                        to="/register"
                        class="small font-weight-bold text-blue"
                        >创建账号</router-link
                      >
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapActions } from "vuex";
export default {
  data() {
    return {
      form: {
        username: "",
        password: "",
      },
    };
  },
  methods: {
    ...mapActions("user", ["loginJS"]),
    onSubmit() {
      this.loginJS(this.form);
    },
  },
};
</script>

<style scoped>
.form-control:focus {
  border-color: #e0e6ed;
  box-shadow: none;
}
.form-control,
.form-group,
.input-group {
  transition: none !important;
}
.text-blue {
  color: #499fee;
}
.text-blue:hover {
  color: #499fee;
}
</style>